package com.doit;

import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.RandomUtils;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.util.ArrayList;

public class test {
    public static void main(String[] args) throws Exception {

        Connection conn = DriverManager.getConnection("jdbc:mysql://rm-cn-9lb3d6hdf000if2o.rwlb.rds.aliyuncs.com:3306/test", "jiang", "Jiang911159");
        PreparedStatement pps = conn.prepareStatement("insert into user_info values (?,?,?,?)");
        ArrayList<String> list = new ArrayList<>();
        list.add("male");
        list.add("female");

        for (int i = 0; i < 1000; i++) {
            pps.setInt(1,i);
            pps.setString(2, RandomStringUtils.randomAlphabetic(8));
            pps.setInt(3, RandomUtils.nextInt(18,48));
            pps.setString(4,list.get(RandomUtils.nextInt(0,list.size())));
            pps.execute();
        }
    }
}


